package com.siao.example.loading.view
{
	import com.siao.example.common.ui.Layer;
	import com.siao.example.loading.Background;
	import com.siao.example.loading.Content;
	import com.siao.mvc.View;
	
	/**
	 * 资源加载视图
	 * @author SiaoLeon
	 */
	public class AssetsLoadView extends View
	{
		// -------------------------------------------------------------------------------------------------------- 静态常量
		
		// -------------------------------------------------------------------------------------------------------- 静态变量
		
		// -------------------------------------------------------------------------------------------------------- 静态方法
		
		// -------------------------------------------------------------------------------------------------------- 静态函数
		
		// -------------------------------------------------------------------------------------------------------- 属性
		
		// -------------------------------------------------------------------------------------------------------- 变量
		
		private var background:Background;
		
		private var content:Content
		
		// -------------------------------------------------------------------------------------------------------- 构造
		
		/**
		 * 构造函数
		 */
		public function AssetsLoadView()
		{
			super();
		}
		
		// -------------------------------------------------------------------------------------------------------- 方法
		
		override public function onAdd():void
		{
			this.background = new Background();
			Layer.instance.background.addChild(this.background);
			
			this.content = new Content();
			Layer.instance.content.addChild(this.content);
		}
		
		override public function onRemove():void
		{
			Layer.instance.background.removeChild(this.background);
			this.background = null;
			
			Layer.instance.content.removeChild(this.content);
			this.content = null;
		}
		
		/**
		 * 设置进度
		 * @param pre
		 */
		public function setProgress(pre:Number):void
		{
			this.content.mcProgressBar.gotoAndStop(Math.round(pre * 100 + 1));
		}
	
		// -------------------------------------------------------------------------------------------------------- 函数
	
	}
}
